/*
 * mainapp.h
 *
 *  Created on: 2011-5-3
 *      Author: chenl
 */

#ifndef MAINAPP_H_
#define MAINAPP_H_

#include "global.h"
#include "logengine/simplelog.h"
#include "logengine/logqueue.h"
#include "logengine/logthread.h"
#include "psthread.h"
#include "uithread.h"

typedef enum tagMainAppCmd
{
	enmMainAppCmd_Nop = 0,
	enmMainAppCmd_Reload,
	enmMainAppCmd_Term,
}MainAppCmd;

class CMainApp
{
public:
	CMainApp();
	~CMainApp();

	int32_t Initialize();
	int32_t Uninitialize();

	int32_t ProcessCommand(int argc, char **argv);

	void Start();
	void Run();

	int32_t Terminate();
	int32_t Resume();
	int32_t Reload();

public:
	CSimpleLog logEngine;

private:
	LogThread logThread_;
	CUIThread uiThread_;
	CPSThread psThread_;
};


typedef Loki::SingletonHolder<CMainApp> 	MainApp;
#define CREATE_MAINAPP_INSTANCE				MainApp::Instance
#define GET_MAINAPP_INSTANCE				MainApp::Instance

#endif /* MAINAPP_H_ */
